package br.uece.laconi.tac.fuzzy;

public class SugenoController extends FuzzyController {
	
	public TriangleFuzzyNumber calculateOutput() {
		
		FuzzyNumber dividend = new TriangleFuzzyNumber(0f,0f,0f);
		FuzzyNumber divisor = new CrispFuzzyNumber(0f);
		TriangleFuzzyNumber z0 = null;
		
		if(alpha.size() == z.size()) {				
			for (int i = 0; i < alpha.size(); i++) {
				dividend = dividend.plus(alpha.get(i).times(z.get(i)));
				divisor = divisor.plus(alpha.get(i));
			}		
			z0 = (TriangleFuzzyNumber) dividend.dividedby(divisor);
		}
		
		return z0;
	}
}
